/**
  ETFAna project, Anyang Normal University && IMP-CAS
  \class ETFGPrompt
  \brief A transient frame - for prompting a user dialog
  \author SUN Yazhou, asia.rabbit@163.com
  \since 2024-05-10
  \date 2024-05-11 last modified
  \attention
  changelog
  <table>
  <tr>  <th>Date         <th>Author      <th>Description                   </tr>
  <tr>  <td>2024-05-10   <td>Asia Sun    <td>file created                  </tr>
  </table>

  \copyright Copyright (c) 2021-2024 Anyang Normal U. && IMP-CAS with LGPLv3 LICENSE
*/

#ifndef ETFGPrompt_h
#define ETFGPrompt_h

#include <string>
#include <pthread.h>
#include <TGFrame.h>

using std::string;

class TGLabel;
class TGTextButton;

class ETFGPrompt : public TGTransientFrame{
public:
  /// \param p gClient->GetRoot()
  /// \param m is the host frame from which this frame prompts
  /// \param useropiton: a pointer to pass the user option out
  /// \param simple true-> only display a message; false-> user reply added
	ETFGPrompt(const TGWindow *p, const TGWindow *m, const string &text,
    bool simple = true, int *useroption = nullptr, int w = 250, int h = 100,
    unsigned options = kVerticalFrame);
	virtual ~ETFGPrompt();

  virtual void Initialize(); ///< creaet all the graphical objects
  virtual void SetText(const string &t);

  virtual void Configure(); ///< visualize all the graphical objects
  virtual void Confirm();
  virtual void Cancel();

	ClassDefOverride(ETFGPrompt, 0);

protected:
  int fWidth, fHeight;
  bool fSimple; ///< only display messages - no user reply

  TGLabel *fTLabel;
  TGCompositeFrame *fPad, *fHBtn;
  TGTextButton *fCancel, *fConfirm;

  string fText; ///< content to show on the label
  /// the return status of user selection - a pointer to transmit data
  int *fUserOption;
};

#endif
